<?php

namespace TableTennis\MatchTypeBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

class MatchTypeAdmin extends Admin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('Contenu')
                ->add('title', null, array('label' => 'Titre'))
                ->add('coefficient', null, array('label' => 'Coëfficient'))
            ->end()
            ->with('Options')
              ->add('type', 'choice', array('choices' => array('team'=> 'Equipes', 'individual' => 'Individuel')))
            ->end()

        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('title')
        ;
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('title')
            ->add('coefficient')
        ;
    }

    /*public function validate(ErrorElement $errorElement, $object)
    {

    }*/
}

?>